package com.mutual.assistance.annotation.impl;


import com.mutual.assistance.annotation.Gender;
import com.mutual.assistance.constant.StringConstant;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;


public class GenderValidator implements ConstraintValidator<Gender, String> {

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        if (null == value) {
            return true;
        }
        return StringConstant.MALE.equals(value)  || StringConstant.FEMALE.equals(value);
    }
}
